import java.io.*;

public class Demo2 {
    public static void main(String[] args) {
        try(Writer writer=new FileWriter("./out.txt")){
            writer.write("hello word");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void main1(String[] args) {
        try(Reader reader=new FileReader("./out.txt")) {
            while(true){
                int c=reader.read();
                if(c==-1){
                    break;
                }
                System.out.println((char)c);
            }
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}
